//
// Created by Nasa on 2024/5/4.
// 埃氏筛法

#include <iostream>

using namespace std;

int main()
{
    int n=1000000;
//    cin >> n;
    bool l[n + 1];
    l[0] = false;
    l[1] = false;
    for (int i = 2; i <= n; ++i)
    {
        l[i] = true;
    }
    for (int i = 2; i * i <= n; ++i)
    {
        if(l[i])
        {
            for (int j = 2 * i; j <= n; j += i)
            {
                l[j] = false;
            }
        }
    }
    int count=0;
    for (int i = 0; i <= n; ++i)
    {
        if(l[i])
        {
            count++;
        }
    }
    cout<<count;
    return 0;
}